package com.clouddot.baipai.model;


import android.content.Context;

import com.clouddot.baipai.contract.IScanFaceFragmentContract;
import com.clouddot.baipai.http.BanPaiRetrofitHelper;
import com.clouddot.baipai.http.ScanFaceHelper;
import com.clouddot.baipai.http.entity.response.loginResponse;
import com.clouddot.baipai.infrastructure.environment.Env;

import org.wxy.sdk.base.impl.BaseModelImpl;

import java.util.HashMap;
import java.util.Map;

import okhttp3.Call;
import rx.Observable;

public class ScanFaceFragmentModel extends BaseModelImpl implements IScanFaceFragmentContract.IModel {
    public ScanFaceFragmentModel(Context context) {
        super(context);

    }


    @Override
    public Call scanFace(String data, String imageType, String topnum, String store) {
        Map<String, String> params = new HashMap<>();
        params.put("base64image",data);
        params.put("imageType",imageType);
        params.put("topnum",topnum);
        params.put("store",store);
        return ScanFaceHelper.getInstance().postComplexForm("http://"+ Env.getAppContext().scanfaceUrl + "/face/verify",params);
    }

    @Override
    public Observable<loginResponse> login(String acttype, String code) {
        return BanPaiRetrofitHelper.getInstance(Env.getContent()).getServer().login(Env.getAppContext().IP,acttype,code);

    }
}
